#     Goblinoid: Experience all of MediaGoblin on an Android Device
#     Copyright (C) 2015 Dylan Jeffers 
# 
#     This program is free software: you can redistribute it and/or modify
#     it under the terms of the GNU General Public License as published by
#     the Free Software Foundation, either version 3 of the License, or
#     (at your option) any later version.
# 
#     This program is distributed in the hope that it will be useful,
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#     GNU General Public License for more details.
# 
#     You should have received a copy of the GNU General Public License
#     along with this program.  If not, see <http://www.gnu.org/licenses/>.

<Login>:
    lsm: lsm
    BoxLayout: 
        orientation: 'vertical'
        BoxLayout:
            size_hint_y: 0.33
            Image: 
                source: 'images/home_goblin.png'
            BoxLayout:
                orientation: 'vertical'
                Label:
                    text: 'Welcome to GNU MediaGoblin'
                    font_size: sp(30)
                    text_size: self.size
                    valign: 'bottom'
                    halign: 'center'
                    multiline: True
                Label:
                    text: 'The perfect tool to show and share your media'
                    font_size: sp(16)
                    text_size: self.size
                    valign: 'middle'
                    halign: 'center'
                    multiline: True
        LoginManager:
            size_hint_y: 0.64
            id: lsm
            on_webfinger: root.webfinger = self.webfinger
            on_verifier_token: root.verifier_token = self.verifier_token


<LoginManager>:
    on_webfinger: self.check_webfinger()
    on_verifier_token: self.check_token()
    on_error_message: self.current_screen.error_message = self.error_message

#will have a tutorial screen eventually
<WebFinger>:
    on_error_message: login_button.text = self.error_message 
    BoxLayout:
        padding: [0,40,0,40]
        orientation: 'vertical'
        TextInput:
            id: text_input
            background_color: [1,1,1,0.5]
            cursor_color: [1,1,1]
            size_hint_y: None
            height: self.minimum_height
            font_size: sp(20)
            multiline: False
            hint_text: 'Enter Webfinger'
            hint_text_color: [1,1,1,1]
            on_text: root.webfinger = self.text; login_button.text = 'Login'
            padding_y: 40
        Button:
            background_color: [1,1,1,0.5]
            id: login_button
            text: 'Login'
            font_size: sp(20)
            size_hint_y: None
            height: text_input.minimum_height
            on_release: root.manager.webfinger = root.webfinger
        Widget:

<Verify>:
    on_error_message: token_button.text = self.error_message
    BoxLayout:
        padding: [0,40,0,40]
        orientation: 'vertical'
        TextInput:
            id: token_input
            background_color: [1,1,1,0.5]
            size_hint_y: None
            height: self.minimum_height
            font_size: sp(20)
            multiline: False
            hint_text: 'Paste Verifier Token'
            padding_y: 40
            on_text: root.verifier_token = self.text; token_button.text = 'Enter'
        Button:
            id: token_button
            text: 'Enter'
            background_color: [1,1,1,0.5]
            font_size: sp(20)
            size_hint_y: None
            height: token_input.minimum_height
            on_release: root.manager.verifier_token = root.verifier_token

        Button:
            text: 'Exit'
            font_size: sp(20)
            background_color: [1,1,1,0.5]
            size_hint_y: None
            height: token_input.minimum_height
            on_release: root.manager.return_to_homescreen()
        Widget:

<EnterApp>:
    BoxLayout:
        orientation: 'vertical'
        size_hint_y: 0.64
        Label:
            id: welcome
            background_color: [1,1,1,0.5]
            text: 
            text: root.welcome_text
            font_size: sp(20)
        Button:
            text: 'Enter'
            background_color: [1,1,1,0.5]
            font_size: sp(20)
            on_release: root.manager.parent.parent.enter_app() 
        Button:
            text: 'Exit'
            background_color: [1,1,1,0.5]
            font_size: sp(20)
            on_release: root.manager.return_to_homescreen()
        Widget:
